//
//  XJYRegisterPasswordTableViewCell.m
//  高仿萝卜书摘
//
//  Created by 谢俊逸 on 2016/11/27.
//  Copyright © 2016年 谢俊逸. All rights reserved.
//

#import "XJYRegisterPasswordTableViewCell.h"

@implementation XJYRegisterPasswordTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.selectionStyle = UITableViewCellSelectionStyleNone;

#pragma mark Notification
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(resignRegisterPasswordCellKeyboradFirstResponder) name:@"resignRegisterPasswordCellKeyboradFirstResponder" object:nil];
    
#pragma mark Add Target For UITextField
    [_passwordTextField addTarget:self action:@selector(editDidBegin:) forControlEvents:UIControlEventEditingDidBegin];
    [_passwordTextField addTarget:self action:@selector(textValueChanged:) forControlEvents:UIControlEventEditingChanged];
    [_passwordTextField addTarget:self action:@selector(editDidEnd:) forControlEvents:UIControlEventEditingDidEnd];
    
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

#pragma mark TextField
- (void)editDidBegin:(id)sender {
    if (self.editDidBeginBlock) {
        self.editDidBeginBlock(self.passwordTextField.text);
    }
}

- (void)editDidEnd:(id)sender {
    if (self.editDidEndBlock) {
        self.editDidEndBlock(self.passwordTextField.text);
    }
}

- (void)textValueChanged:(id)sender {
    if (self.textValueChangedBlock) {
        self.textValueChangedBlock(self.passwordTextField.text);
    }
}


#pragma Notification action
- (void)resignRegisterPasswordCellKeyboradFirstResponder{
    [_passwordTextField resignFirstResponder];
}

@end
